//
//  ZJPopupView.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/9/25.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJPopupView.h"
#import "JCAlertView.h"

@interface ZJPopupView ()<ZJHomePopupViewDelegate>
{
    JCAlertView * alertView;
}
@end

@implementation ZJPopupView

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.View = [ZJHomePopupView new];
        self.View.delegate = self;
        alertView = [[JCAlertView alloc] initWithCustomView:self.View dismissWhenTouchedBackground:YES];
    }
    return self;
}

- (void)setupUI_dataArray:(NSArray *)dataArray{
    [self.View setupUI_dataArray:dataArray];
}

#pragma mark - ZJHomePopupViewDelegate 协议方法
- (void)ZJHomePopupViewDelegate_buttonClickWithIndex:(NSInteger)index{
    [self hidden];
    if (self.delegate) {
        [self.delegate popupView:self buttonClickWithIndex:index];
    }
    
}

- (void)ZJHomePopupViewDelegate_canleClick{
    [self hidden];
}

- (void)show{
    [alertView show];
}

- (void)hidden{
    [alertView dismissWithCompletion:nil];
}


@end
